#include "StomperLib/Controls/OverlayDialog.h"
#include <Gwen/Font.h>
#include <Gwen/Skin.h>
namespace StomperLib {
namespace Controls {
GWEN_CONTROL_CONSTRUCTOR( OverlayDialog )
{
  this->SetMargin( Gwen::Margin( 15, 15, 15, 15 ));
  Gwen::Controls::Base* t = new Gwen::Controls::Base( this );
  t->SetHeight( 35 );
  t->Dock( Gwen::Pos::Top );
  m_Title = new Gwen::Controls::Label( t );
  m_Title->Dock( Gwen::Pos::Top );
  m_Title->SetHeight( 30 );
  m_Title->SetText( "OK" );
  m_Title->SetMargin( Gwen::Margin( 5, 10, 5, 10 ));
  Gwen::Controls::Base* bottom = new Gwen::Controls::Base( this );
  bottom->Dock( Gwen::Pos::Bottom );
  bottom->SetHeight( 40 );
  Gwen::Controls::Layout::Tile* buttonTile = new Gwen::Controls::Layout::Tile( bottom );
  buttonTile->SetSize( 280, 30 );
  buttonTile->SetTileSize( 130, 30 );

  //buttonTile->SetHeight(50);
  buttonTile->Dock( Gwen::Pos::Right );
  m_OKButton = new Gwen::Controls::Button( buttonTile );
  m_OKButton->SetText( "Create" );
  m_OKButton->SetDisabled( true );
  Gwen::Controls::Button* cancelButton = new Gwen::Controls::Button( buttonTile );
  cancelButton->SetText( "Cancel" );
  cancelButton->onDown.Add( this, &OverlayDialog::OnCancel );
}
void OverlayDialog::Render( Gwen::Skin::Base* skin )
{
  if ( ShouldDrawBackground( ) )
    skin->DrawTreeControl( this );
}

void OverlayDialog::OnCancel( )
{
  this->onCancel.Call( this );
  this->Hide( );
}

}
}
